// pages/index/comps/advPop/advPop.js
const common = require('../../../../utils/util.js')
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        showAdv: Boolean,
        popImg: Object,
        nowDate: String
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        closeAdv: function() {
            this.triggerEvent('closeAdv')
        },
        myCatchTouch: function() {
            return
        },
        goShopkeeperGifts: function() {
            this.triggerEvent('closeAdv')
            // wx.navigateTo({
            //     url: '/pages/goods/shopKeeperGifts/shopKeeperGifts'
            // })
            wx.navigateToMiniProgram({
                appId: 'wxced62ee96fa82223',
                path: '/pages/index/index',
                success(res) {
                    // 打开成功
                    console.log(res)
                }
            })
        },
        formGo: function(e) {
            let data = {
                form_id: e.detail.formId
            }
            if (wx.getStorageSync('token')) {
                common.post('User/up_form_id', data).then(function(res) {}).catch(function(e) {})
            }
            this.triggerEvent('closeAdv')
            wx.navigateTo({
                url: this.data.popImg.url
            })
            // wx.navigateToMiniProgram({
            //     appId: 'wxced62ee96fa82223',
            //     path: '/pages/index/index',
            //     success(res) {
            //         // 打开成功
            //         console.log(res)
            //     }
            // })
        },
        formGoTo: function(e) {
            let data = {
                form_id: e.detail.formId
            }
            if (wx.getStorageSync('token')) {
                common.post('User/up_form_id', data).then(function(res) {}).catch(function(e) {})
            }
            this.triggerEvent('closeAdv')
        }
    }
})